<% if (!_.isUndefined(APPS) && APPS !== null && !_.isUndefined(APPS.enabled_apps) && APPS.enabled_apps !== null && $.inArray('r_export_csv',APPS.enabled_apps) !== -1) { %>
	<div class="export-csv-block" style="height: 34px;"></div>
<% } %>
<%  var listviewsortby, listviewsortdirection;
	if (!_.isUndefined(App.current_board) && !_.isUndefined(App.current_board) && App.current_board !== null && !_.isUndefined(App.current_board.attributes.listviewsortby) && App.current_board.attributes.listviewsortby !== null) {
		listviewsortby = App.current_board.attributes.listviewsortby;
		listviewsortdirection = App.current_board.attributes.listviewsortdirection; 
	} else {
		listviewsortby = 'id';
		listviewsortdirection = 'desc';
	}
%>
<div class="row">
<div class="pull-right dropdown js-list-response">
	<a data-toggle="dropdown" class="btn btn-primary dropdown-toggle col-sm-offset-1 show" type="button"><i class="icon-sort h3 cur"></i></a>
	<ul class="dropdown-menu arrow arrow-right col-xs-12">
		<div class="clearfix text-center col-xs-12">
			<span class="col-xs-10 navbar-btn"><strong>Sort</strong></span>
			<a class="js-close-sub-popover pull-right" href="#"><i class="icon-remove"></i></a>
		</div>
		<div class="col-xs-12 divider"></div>
		<li><a class="card-id js-sort-by show" title="<%- i18next.t('ID') %>" href="#" data-sort-by="id"><span class="<% if (listviewsortby === 'id' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'id') { %> hide <% } %>"></span><%- i18next.t("ID") %></a></li>
		<li><a class="js-sort-by show" title="<%- i18next.t('Labels') %>" href="#" data-sort-by="sort_group_label"><span class="<% if ( listviewsortby === 'sort_group_label' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'sort_group_label') { %> hide <% } %>"></span><%- i18next.t("Labels") %></a></li>
		<li><a class="js-sort-by show" title="<%- i18next.t('Card Name') %>" href="#" data-sort-by="name"><span class="<% if ( listviewsortby === 'name' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'name') { %> hide <% } %>"></span><%- i18next.t("Card Name") %></a></li>
		<li><a class="js-sort-by show" title="<%- i18next.t('List Name') %>" href="#" data-sort-by="list_name"><span class="<% if ( listviewsortby === 'list_name' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'list_name') { %> hide <% } %>"></span><%- i18next.t("List Name") %></a></li>
		<li><a class="js-sort-by show" title="<%- i18next.t('Members') %>" href="javascript:void(0);" data-sort-by="sort_group_user"><span class="<% if ( listviewsortby === 'sort_group_user' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'sort_group_user') { %> hide <% } %>"></span><%- i18next.t("Members") %></a></li>
		<li class="js-list-start-date-data hide"><a class="js-sort-by show" title="<%- i18next.t('Start Date') %>" href="#" data-sort-by="start_date"><span class="<% if ( listviewsortby === 'start_date' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'start_date') { %> hide <% } %>"></span><%- i18next.t("Start Date") %></a></li>
		<li><a class="show js-sort-by" href="#" title="<%- i18next.t('End Date') %>" data-sort-by="due_date"><span class="<% if ( listviewsortby === 'due_date' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'due_date') { %> hide <% } %>"></span><%- i18next.t("End Date") %></a></li>
		<li><a class="show js-sort-by" href="#" title="<%- i18next.t('Votes') %>" data-sort-by="card_voter_count"><span class="<% if ( listviewsortby === 'card_voter_count' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'card_voter_count') { %> hide <% } %>"></span><%- i18next.t('Votes') %></a></li>
		<li><a class="js-sort-by show" href="#" title="<%- i18next.t('Attachments') %>" data-sort-by="attachment_count"><span class="<% if ( listviewsortby === 'attachment_count' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'attachment_count') { %> hide <% } %>"></span><%- i18next.t('Attachments') %></a></li>
		<li><a class="js-sort-by show" href="#" title="<%- i18next.t('Comments') %>" data-sort-by="comment_count"><span class="<% if ( listviewsortby === 'comment_count' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'comment_count') { %> hide <% } %>"></span><%- i18next.t('Comments') %></a></li>
		<li><a class="js-sort-by show" href="#" title="<%- i18next.t('Checklist') %>" data-sort-by="checklist_item_completed_count"><span class="<% if ( listviewsortby === 'checklist_item_completed_count' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'checklist_item_completed_count') { %> hide <% } %>"></span><%- i18next.t('Checklist') %></a></li>
	</ul>
</div>
</div>
<% 
	var listviewconfigure = false;
	if (!_.isUndefined(APPS) && APPS !== null && !_.isUndefined(APPS.enabled_apps) && APPS.enabled_apps !== null && $.inArray('r_listview_configure', APPS.enabled_apps) !== -1) {
		if (!_.isUndefined(board) && !_.isEmpty(board) && !_.isUndefined(board.attributes) && !_.isEmpty(board.attributes) && !_.isUndefined(board.attributes.board_custom_fields) && !_.isEmpty(board.attributes.board_custom_fields) && board.attributes.board_custom_fields !== null) {
			var board_custom_fields = JSON.parse(board.attributes.board_custom_fields);
			if (!_.isUndefined(board_custom_fields['r_listview_configure']) && _.isEmpty(board_custom_fields['r_listview_configure'])) {
				listviewconfigure = true;
			}
		}
	}
%>
<div class="row emoji-list js-listview-configure-info <% if (!listviewconfigure) { %> hide <% } %>">
	<div class="col-xs-12 text-center navbar-btn alert alert-info">
		<% if (!_.isEmpty(authuser.user) && !_.isUndefined(authuser.user) && !_.isEmpty(role_links.where({slug: "r_listview_configure"}))) { %>
			<%= i18next.t('All the list view fields are hidden by list view configuration, you can configure in %s', {postProcess: 'sprintf', sprintf: ['<a href="javascript:void(0);" class="text-primary js-trigger-listview-configure" title="'+ i18next.t('List View Column Chooser') +'">'+ i18next.t('List View Column Chooser') +'.</a>']}) %>
		<% } else { %>
			<%= i18next.t('All the list view fields are hidden by list view configuration, you can configure in %s', {postProcess: 'sprintf', sprintf: ['<a href="javascript:void(0);" class="text-primary" title="'+ i18next.t('List View Column Chooser') +'">'+ i18next.t('List View Column Chooser') +'.</a>']}) %>
		<% } %>
	</div>
</div>
<div class="well-sm"></div>
<div class="table-responsive js-boardList-view">
	<table class="table">
	<thead>
		<tr id="list_view_configuration_label">
			<th class="card-id" id="list_view_config_label-id" data-field-name="id"><a class="js-sort-by show" title="<%- i18next.t('ID') %>" href="#" data-sort-by="id"><span class="<% if (listviewsortby === 'id' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'id') { %> hide <% } %>"></span><%- i18next.t("ID") %></a></th>
			<th id="list_view_config_label-labels" data-field-name="labels"><a class="js-sort-by show" title="<%- i18next.t('Labels') %>" href="javascript:void(0);" data-sort-by="sort_group_label"><span class="<% if ( listviewsortby === 'sort_group_label' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'sort_group_label') { %> hide <% } %>"></span><%- i18next.t("Labels") %></a></th>
			<th id="list_view_config_label-name" data-field-name="name"><a class="js-sort-by show" title="<%- i18next.t('Card Name') %>" href="#" data-sort-by="name"><span class="<% if ( listviewsortby === 'name' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'name') { %> hide <% } %>"></span><%- i18next.t("Card Name") %></a></th>
			<th id="list_view_config_label-list_name" data-field-name="list_name"><a class="js-sort-by show" title="<%- i18next.t('List Name') %>" href="#" data-sort-by="list_name"><span class="<% if ( listviewsortby === 'list_name' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'list_name') { %> hide <% } %>"></span><%- i18next.t("List Name") %></a></th>
			<th id="list_view_config_label-cards_users" data-field-name="cards_users"><a class="js-sort-by show" title="<%- i18next.t('Members') %>" href="javascript:void(0);" data-sort-by="sort_group_user"><span class="<% if ( listviewsortby === 'sort_group_user' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'sort_group_user') { %> hide <% } %>"></span><%- i18next.t("Members") %></a></th>
			<th id="list_view_config_label-start_date" data-field-name="start_date" class="js-list-start-date hide field_heading"></th>
			<th id="list_view_config_label-due_date" data-field-name="due_date"><a class="show" href="javascript:void(0);" title="<%- i18next.t('End Date') %>" ><span class="<% if ( listviewsortby === 'due_date' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'due_date') { %> hide <% } %>"></span><i data-sort-by="due_date" class="js-sort-by icon-calendar h3"></i></a></th>
			<th id="list_view_config_label-estimated_time" class="js-list-estimated-time hide" data-field-name="estimated_time"></th>
			<th id="list_view_config_label-spent_time" class="js-list-spent-time hide" data-field-name="spent_time"></th>
			<th id="list_view_config_label-subscribe" data-field-name="subscribe"><a class="show" title="<%- i18next.t('Subscribe') %>" ><i class="icon-eye-open"></i></a></th>
			<th id="list_view_config_label-card_voter_count" data-field-name="card_voter_count"><a class="show" href="javascript:void(0);" title="<%- i18next.t('Votes') %>" ><span class="<% if ( listviewsortby === 'card_voter_count' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'card_voter_count') { %> hide <% } %>"></span><i  data-sort-by="card_voter_count" class="js-sort-by icon-thumbs-up h3"></i></a></th>
			<th id="list_view_config_label-attachment_count" data-field-name="attachment_count"><a class="show" href="javascript:void(0);" title="<%- i18next.t('Attachments') %>" ><span class="<% if ( listviewsortby === 'attachment_count' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'attachment_count') { %> hide <% } %>"></span><i data-sort-by="attachment_count" class="js-sort-by icon-paper-clip h3"></i></a></th>
			<th id="list_view_config_label-comment_count" data-field-name="comment_count"><a class="show" href="javascript:void(0);" title="<%- i18next.t('Comments') %>"><span class="<% if ( listviewsortby === 'comment_count' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'comment_count') { %> hide <% } %>"></span><i data-sort-by="comment_count" class="js-sort-by icon-comment h3"></i></a></th>
			<th id="list_view_config_label-checklist_item_completed_count" data-field-name="checklist_item_completed_count"><a class="show" href="javascript:void(0);" title="<%- i18next.t('Checklist') %>" ><span class="<% if ( listviewsortby === 'checklist_item_completed_count' && listviewsortdirection === 'asc') { %> icon-caret-up <% } else { %> icon-caret-down <% } %><% if(listviewsortby !== 'checklist_item_completed_count') { %> hide <% } %>"></span><i  data-sort-by="checklist_item_completed_count" class="js-sort-by icon-list-ul h3"></i></a></th>
			<% if (!_.isUndefined(APPS) && APPS !== null && !_.isUndefined(APPS.enabled_apps) && APPS.enabled_apps !== null && $.inArray('r_custom_fields',APPS.enabled_apps) !== -1) {
				if (!_.isUndefined(board) && !_.isEmpty(board) && !_.isUndefined(board.attributes.custom_fields) && board.attributes.custom_fields !== null) {
					_.each(board.attributes.custom_fields, function(customfield){ %>
						<th class="js-list-customField-<%- customfield.id %>" id="list_view_config_label-<%- customfield.name %>" data-field-name="<%- customfield.name %>"><a class="show" href="javascript:void(0);" title="<%- customfield.label %>" ><%- customfield.label %></a></th>
				<% });
				} else { %>
					<th class="hide js-custom-fields-list_view-header"></th>
				<% } 
			} %>
		<tr>
	</thead>
	<tbody class="js-card-list-view-<%- board.id%>"></tbody>
	</table>
</div>
<div id="js-empty-filter-cards" class="col-xs-12 text-center alert alert-info hide" style="margin-top: -20px;"><%- i18next.t('No %s available.', { postProcess: 'sprintf', sprintf: [i18next.t('cards')] }) %></div>
</div>